import java.io.*;
import java.util.*;

import local.util.MyLog;

public class GetTickFromFile  {

    private Hashtable tickHashTable = new Hashtable ();
    private String fileName = null;

    public static void main( String args[] )
    {
	GetTickFromFile finder = new GetTickFromFile();
	finder.setTickFileName("test.txt");
	finder.loaderTickFile();
	finder.printTickHashTable(finder.getTickHashTable());
    }

    public void setTickFileName (String tick_file) {
	fileName = tick_file;
    }

    public void loaderTickFile () {

       File name = new File(fileName);

       if ( !name.exists() ) {
	   MyLog.message("File:"+name.getName()+" not found!");
	   return;
       }

       if ( name.isFile() ) {
	   try {
               RandomAccessFile r =  new RandomAccessFile( name, "r" );
               String text;

               while( ( text = r.readLine() ) != null ) {
		   tickHashTable.put(text, text);
	       }
	   }
	   catch( IOException e ) {

	   }
       }
    }

    public Hashtable getTickHashTable () {
	return tickHashTable;
    }
    
    public void printTickHashTable ( Hashtable hashTab) {
	String symbol = null;

	Enumeration enum = hashTab.keys();  	   
	while (enum.hasMoreElements()) {
	    symbol = (String)enum.nextElement();
	    MyLog.message(symbol);
	}
    }
}



